You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
580 B
24 lines
580 B
import { requireAdmin } from "#server/utils/admin-guard";
|
|
import { updateModel } from "#server/service/llm";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
await requireAdmin(event);
|
|
|
|
const id = Number(getRouterParam(event, "id"));
|
|
if (!id) {
|
|
return R.throwError(400, "无效的模型ID", null);
|
|
}
|
|
|
|
const body = await readBody(event);
|
|
const { name, modelId, type, enabled, description, maxTokens } = body;
|
|
|
|
await updateModel(id, {
|
|
name,
|
|
modelId,
|
|
type,
|
|
enabled,
|
|
description,
|
|
maxTokens,
|
|
});
|
|
return R.success(null);
|
|
});
|
|
|